<?php

/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

require_once("conexao.php");
if (isset($_GET['men'])) {
    $men = $_GET['men'];
    $query = "SELECT * FROM menssagem WHERE menssagem = $men;";
    $rows = mysql_query($query);
    $ret = "";
    while ($rs = mysql_fetch_array($rows)) {
        $autor = $rs['autor'];
        $texto = $rs['texto'];
        $ret = $autor . "|" . $texto;
    }
    echo $ret;
} else {
    $query = "SELECT count(menssagem) as total FROM menssagem;";
    $rows = mysql_query($query);
    $total = 0;
    while ($rs = mysql_fetch_array($rows)) {
        $total = $rs['total'];
    }
    echo $total;
}
?>
